package Controller.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;
import org.springframework.web.servlet.mvc.Controller;

import Bean.SboardBean;
import Bean.SingerBean;
import Dao.SingerDao;
import Dao.adminDao;

public class singerInsertController implements Controller{
	private adminDao dao;
	
	public void setDao(adminDao dao) {
		this.dao = dao;
	}

	@Override
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse arg1) throws Exception {
		String s_singer = request.getParameter("s_singer");
		String s_gender = request.getParameter("s_gender");
		String s_members = request.getParameter("_members");
		
		SingerBean bean = new SingerBean();
		bean.setS_singer(s_singer);
		bean.setS_gender(s_gender);
		bean.setS_members(s_members);
		
		dao.insertSinger(bean);
		
		ModelAndView mav = new ModelAndView();
		mav.setViewName("redirect:/mypageForm.mb");
		return mav;
	}
}
